package com.example.service.impl;

import com.example.domain.pojo.Order;
import com.example.service.IOrderProducer;
import com.example.utils.RabbiMqSendUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.MessageDeliveryMode;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

/**
 * @author ljs
 * @date 2025/7/16
 */
@Service
@Slf4j
public class OrderProducer implements IOrderProducer {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Override
    public void sendOrder(Order order) {

        RabbiMqSendUtil.send(rabbitTemplate,order,
                "order.exchange",
                "order.routingKey",
                MessageDeliveryMode.PERSISTENT);
    }

}
